package shared;

import java.util.ArrayList;

import processing.core.PApplet;
import processing.core.PVector;

import birdsVSZombiesComponents.AbstractBox2DShape;
import birdsVSZombiesServer.BirdsVSZombiesCollision;

public class BVZServerToClientsEvents {
	
	public static PApplet parent;
	
	public int eventType;
	
	public int winner;
	
	//TODO Sending the whole collision event may cause some security issues, because the
	//		BVZCollision class have the server itself.
	//		Find a safe and more efficient way to do this.
//	public BirdsVSZombiesCollision collisionEvent;
	
	public ArrayList<String> relatedItemsType = new ArrayList<String>();
	public ArrayList<PVector> relatedItemsPosition = new ArrayList<PVector>();
	public ArrayList<Integer> relatedItemsCurrentCollisionNum = new ArrayList<Integer>();
	public PVector collisionPosition;
	
	public BVZServerToClientsEvents(int e, BirdsVSZombiesCollision col){
		this.eventType = e;
		
		for(String type : col.itemTypes){
			this.relatedItemsType.add(type);
		}
		
		for(AbstractBox2DShape colItem : col.collisionItems){
			PVector pos = new PVector(colItem.baseX, colItem.baseY);
			relatedItemsPosition.add(pos);
			
			relatedItemsCurrentCollisionNum.add(colItem.currentCollisionNum);
		}
		
		collisionPosition = new PVector(col.collision.getX(), col.collision.getY());
		
	}
	
	public BVZServerToClientsEvents(int e, int winner){
		this.eventType = e;
		this.winner = winner;
	}
	
	public BVZServerToClientsEvents(){
		
	}
}
